home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / remote / mult200.zip / BBSCMNTD.BAT < prev    next >
DOS Batch File  |  1991-12-10  |  32KB  |  936 lines

  1. @echo off
  2. rem ******************************************************
  3. rem *                                                    *
  4. rem * BBS.BAT file for 3 Node BBS under DesQView.        *
  5. rem * Nodes 1 & 2 run the Front Door Mailer to answer    *
  6. rem * the phone. 3rd runs in LOCAL mode.                 *
  7. rem * In this setup, all three nodes use IMail for       *
  8. rem * echomail tossing and scanning and MBUtil for       *
  9. rem * importing and exporting NETMail.                   *
  10. rem *                                                    *
  11. rem ******************************************************
  12.  
  13. rem ******************************************************
  14. rem * The FIRST thing we must do is see if we are        *
  15. rem * "reloading" BBS.BAT. This is done when we run the  *
  16. rem * DOBBS.BAT that FrontDoor creates. It is done so    *
  17. rem * we can get the TimeToNextEvent from FD and pass it *
  18. rem * on to RA. This way, you don't have to duplicate    *
  19. rem * your events in FD and RA. If this is a reload, we  *
  20. rem * jump down and run RA since we now have everything  *
  21. rem * set in the environment variables.                  *
  22. rem ******************************************************
  23.  
  24. if .%1 == .reload goto loadra
  25. cls
  26.  
  27. rem ******************************************************
  28. rem * Check to see if we are trying to load this node a  *
  29. rem * second time. This is a BIG NO NO! You can only run *
  30. rem * each node once. This was added to prevent          *
  31. rem * "FAT FINGERS".                                     *
  32. rem ******************************************************
  33.  
  34. if not exist c:\ra\%node%load.txt goto ok2load
  35. echo.
  36. echo 
  37. echo The system shows that Node %node% is already loaded!
  38. echo.
  39. echo If you KNOW that Node %node% is not loaded and is being
  40. echo brought back up after a crash (closing down the DV window
  41. echo without exiting FD correctly ie: ALT C Y), then you need
  42. echo to go to your RA directory delete the %node%LOAD.TXT file
  43. echo and create the %node%ISDOWN.TXT file. Then you can reload
  44. echo this Node.
  45. echo.
  46. echo Press [ENTER] to close this Task down.
  47. pause
  48. goto endok3
  49.  
  50. rem ******************************************************
  51. rem * it's OK 2 load this task, so let's do it...        *
  52. rem * set port variable dependent on each node. this     *
  53. rem * MUST the com port you are using for the task. it   *
  54. rem * is used to handle the modem from this and other    *
  55. rem * .BAT files. this is VERY important!                *
  56. rem ******************************************************
  57.  
  58. :ok2load
  59. if %node% == N1 set port=1
  60. if %node% == N2 set port=2
  61. if %node% == N3 set port=0
  62. echo.
  63. echo Selected Port is %port%.
  64. echo.
  65.  
  66. rem ******************************************************
  67. rem * set up variables for each node. *NOTE* FD must     *
  68. rem * have a seperate system directory for each node.    *
  69. rem * make sure you set IMail and MBUtil correctly.      *
  70. rem ******************************************************
  71.  
  72. set fd=c:\fd\%node%
  73. set fdovr=c:\fd
  74. set fmovr=c:\fd
  75. set fdopt=INTL
  76. set ra=c:\ra
  77. set raovr=c:\ra
  78. set imail=c:\ra
  79. set mbu=c:\ra\mbutil.ctl
  80.  
  81. rem ******************************************************
  82. rem * check to see if we are running under DV. if we are *
  83. rem * we load the DV ANSI driver and recapture the FOSSIL*
  84. rem * driver interrupt. otherwise, we load (or try to)   *
  85. rem * the FOSSIL driver. This was added so that we could *
  86. rem * the BBS as a single line in an emergency.          *
  87. rem * Notice that we load DESQview's DVANSI.COM even if  *
  88. rem * we are NOT running under DV. this is because DVANSI*
  89. rem * uses up to 2K less memory and you don't have to put*
  90. rem * it in your CONFIG.SYS file.                        *
  91. rem ******************************************************
  92.  
  93. echo.
  94. echo Checking for DESQview.
  95. dvactive
  96. if errorlevel 1 goto dvstuff
  97. echo.
  98. echo DESQview NOT detected.
  99. echo Loading ANSI driver and FOSSIL driver..
  100. c:\dv\dvansi
  101. bnu /f+ /m- /q
  102. bnu /c
  103. goto start
  104.  
  105. :dvstuff
  106. echo.
  107. echo DESQview Detected!
  108. echo Loading ANSI driver and Recapturing the FOSSIL interrupt...
  109. echo.
  110. c:\dv\dvansi
  111. bnu /c
  112.  
  113. rem ******************************************************
  114. rem * All this mess loops back to here each time.        *
  115. rem * make sure we are on the correct drive and go to    *
  116. rem * the correct directory for each node. Then run the  *
  117. rem * correct FD for each node. Each FD has a different  *
  118. rem * setup and control files!                           *
  119. rem * *NOTE* We are NOT running in Shell to Mailer mode! *
  120. rem ******************************************************
  121.  
  122. rem ******************************************************
  123. rem * make sure the lockout files are NOT there incase   *
  124. rem * of a system error or failure! we also check for    *
  125. rem * and delete any stray DOBBS.BAT files that might be *
  126. rem * in this nodes directory. then we create the        *
  127. rem * semaphore file that tells the other nodes that     *
  128. rem * this one is loaded and running.                    *
  129. rem ******************************************************
  130.  
  131. :start
  132. echo.
  133. echo Removing old %node% lockout files.
  134. if exist c:\ra\%node%*.txt del c:\ra\%node%*.txt
  135. if exist c:\ra\%node%\dobbs.bat del c:\ra\%node%\dobbs.bat
  136. rem>c:\ra\%node%load.txt
  137.  
  138. rem ******************************************************
  139. rem * everything is OK so lets get into the right node   *
  140. rem * directory and start this puppy.                    *
  141. rem ******************************************************
  142.  
  143. echo.
  144. echo Node %node% is going back online!
  145. c:
  146. cd\ra\%node%
  147.  
  148. rem ******************************************************
  149. rem * if we are node 3 goto local logon only!            *
  150. rem ******************************************************
  151.  
  152. if %node% == N3 goto ralocal
  153.  
  154. rem ******************************************************
  155. rem * load and run Frontdoor                             *
  156. rem ******************************************************
  157.  
  158. c:\fd\fd.exe
  159.  
  160. rem ******************************************************
  161. rem * check errorlevels from FD. if call is human, set   *
  162. rem * correct baud rate before loading RA.               *
  163. rem ******************************************************
  164.  
  165. if errorlevel 255 goto diffexit
  166. if errorlevel 240 set baud=2400
  167. if errorlevel 240 goto racall
  168. if errorlevel 120 set baud=1200
  169. if errorlevel 120 goto racall
  170. if errorlevel 110 set baud=300
  171. if errorlevel 110 goto racall
  172. if errorlevel 101 goto outbound
  173. if errorlevel 100 goto inbound
  174. if errorlevel  40 goto ralocal
  175. if errorlevel  33 goto nightly
  176. if errorlevel  31 goto weekly
  177. if errorlevel  10 goto endok
  178. if errorlevel   1 goto enderror
  179.  
  180. rem ******************************************************
  181. rem * this node has been told to exit with errorlevel    *
  182. rem * 255. this is the errorlevel we use to shutdown the *
  183. rem * FD nodes so we can process a new nodediff file.    *
  184. rem ******************************************************
  185.  
  186. :diffexit
  187. dtr com%port%: on
  188. at com%port%: h1
  189. echo.
  190. echo Notifying other nodes that I'm DOWN....
  191. rem>c:\ra\%node%down.txt
  192. goto endok2
  193.  
  194. rem ******************************************************
  195. rem * check to see if another node is tossing inbound    *
  196. rem * mail. if so let the caller know and exit. otherwise*
  197. rem * create utility lockout file for individual nodes   *
  198. rem * as they come online for a human caller and load    *
  199. rem * RA with environment variables set for each node.   *
  200. rem ******************************************************
  201.  
  202. :racall
  203. cls
  204. echo.
  205. echo We have a caller!
  206. if exist c:\ra\N?toss.txt goto fdbusy
  207. rem>c:\ra\%node%isup.txt
  208.  
  209. rem ******************************************************
  210. rem * check for DOBBS.BAT created by FD. if it there,    *
  211. rem * execute it so we can get the TimeToNextEvent.      *
  212. rem ******************************************************
  213.  
  214. if not exist c:\ra\%node%\dobbs.bat goto loadra
  215. dobbs.bat
  216.  
  217. :loadra
  218. ra -%node% -C%port% -B%baud% -E20 %event%
  219.  
  220. rem ******************************************************
  221. rem * check errorlevels after RA exit.                   *
  222. rem ******************************************************
  223.  
  224. :afterra
  225. echo.
  226. echo Checking Remote Access Exit Errorlevels....
  227. if errorlevel 20 goto update
  228. if errorlevel 11 goto ldv
  229. if errorlevel  5 goto outbound
  230. if errorlevel  4 goto outbound
  231. if errorlevel  3 goto outbound
  232. if errorlevel  2 goto ralocal
  233. if errorlevel  1 goto enderror
  234. if errorlevel  0 goto endok
  235.  
  236. rem ******************************************************
  237. rem * this section is mainly to show a type 15 exit and  *
  238. rem * reloading procedure. this one uses errorlevel 11   *
  239. rem * to exit RA and run. this sample runs L.D.V. which  *                               
  240. rem * is LongDistanceVerifier. it has the user fill out a*
  241. rem * form which is then mailed to them with a special   *
  242. rem * password. the user, when they receive the form,    *
  243. rem * calls back, reenters LDV and enters the special    *
  244. rem * password. LDV then upgrades the user according to  *
  245. rem * your specs.                                        *
  246. rem ******************************************************
  247.  
  248. :ldv
  249. echo.
  250. echo Running Long Distance Verifier.
  251. ldv
  252. echo.
  253. echo Notifying User of making sure to leave SysOp Feedback
  254. echo so I can make sure I mail him his special LDV password.
  255. echo.>com%port%:
  256. echo.>com%port%:
  257. echo Please leave me a message stating that you had to use LDV>com%port%:
  258. echo so you could have access to this system. If you don't tell>com%port%:
  259. echo me, it will take longer for you to get your letter.>com%port%:
  260. echo.>com%port%:
  261. echo This option isn't used very much and i don't check it>com%port%:
  262. echo very often.>com%port%:
  263. echo.>com%port%:
  264. echo Thank you,>com%port%:
  265. echo Sysop>com%port%:
  266. dvcomand wait 50
  267. goto restart
  268.  
  269. rem ******************************************************
  270. rem * this section is where we come to reload RA after   *
  271. rem * a type 15 exit. when we exit this time, we go back *                                   
  272. rem * to AFTERRA so we can check the errorlevels from    *
  273. rem * there. this is to avoid having to duplicate them in*
  274. rem * this already monstrous .BAT file.                  *
  275. rem ******************************************************
  276.  
  277. :restart 
  278. echo.
  279. echo Reloading RA after a type 15 exit...
  280. c:
  281. cd\ra\%node%
  282. ra -R -G -E20 -%node% -C%port% -B%baud%
  283. goto afterra
  284.  
  285. rem ******************************************************
  286. rem * we have inbound mail! take node 1's phone off hook *
  287. rem * and make sure node 2 is not online before tossing. *
  288. rem * if node 2 IS online, create a mailwaiting file so  *
  289. rem * the waiting mail can be processed as soon as node  *
  290. rem * is finished. in this case, we will let node 2 run  *
  291. rem * the tosser otherwise node 1 will always toss.      *
  292. rem * this is so that node 1 can be ready to accept      *
  293. rem * human callers as soon as possible.                 *
  294. rem ******************************************************
  295.  
  296. :inbound
  297. cls
  298. echo.
  299. echo We have inbound mail!
  300. echo.
  301. if exist c:\ra\N?toss.txt goto innodechk
  302. if exist c:\ra\n3inchck.txt goto 3upin
  303. if exist c:\ra\n2inchck.txt goto 2upin
  304. if exist c:\ra\n1inchck.txt goto 1upin
  305. if exist c:\ra\N3outchk.txt goto 3upin
  306. if exist c:\ra\N1outchk.txt goto 2upin
  307. if exist c:\ra\N2outchk.txt goto 1upin
  308. if %node% == N1 goto downthisnode
  309. if %node% == N2 goto downthisnode
  310. if %node% == N3 goto 3upin
  311.  
  312. rem ******************************************************
  313. rem * if we have just recieved a mail packet while we    *
  314. rem * are already tossing one, we will wait till next    *
  315. rem * time to toss it, so don't worry about it right now *
  316. rem ******************************************************
  317.  
  318. :innodechk
  319. echo.
  320. echo Another node is already Tossing INBOUND mail.
  321. echo Waiting till later...
  322. if %node% == N1 goto start
  323. if %node% == N2 goto start
  324. if %node% == N3 del c:\ra\%node%*.txt
  325. If %node% == N3 goto end
  326.  
  327. rem ******************************************************
  328. rem * take node offhook                                  *
  329. rem ******************************************************
  330.  
  331. :downthisnode
  332. dtr com%port%: off
  333. dtr com%port%: on
  334. at com%port%: h1
  335. if %node% == N1 goto 2upin
  336. if %node% == N2 goto 1upin
  337.  
  338. rem ******************************************************
  339. rem * check for node 1 and node 2 online                 *
  340. rem * if so, create waiting mail file.                   *
  341. rem ******************************************************
  342.  
  343. :3upin
  344. if exist c:\ra\N1isup.txt goto 3upin1
  345. if exist c:\ra\N2isup.txt goto 3upin1
  346.  
  347. rem ******************************************************
  348. rem * otherwise toss the mail!                           *
  349. rem ******************************************************
  350.  
  351. goto tossit
  352.  
  353. rem ******************************************************
  354. rem * create mail waiting file and loop back to start    *
  355. rem ******************************************************
  356.  
  357. :3upin1
  358. rem > c:\ra\mail!.txt
  359. if exist c:\ra\%node%*.txt del c:\ra\%node%*.txt
  360. goto end
  361.  
  362. rem ******************************************************
  363. rem * check for node 2 and node 3 online                 *
  364. rem * if so, create waiting mail file.                   *
  365. rem ******************************************************
  366.  
  367. :2upin
  368. if exist c:\ra\N2isup.txt goto 2upin1
  369. if exist c:\ra\N3isup.txt goto 2upin1
  370.  
  371. rem ******************************************************
  372. rem * otherwise toss the mail!                           *
  373. rem ******************************************************
  374.  
  375. goto tossit
  376.  
  377. rem ******************************************************
  378. rem * create mail file and loop back to start            *
  379. rem ******************************************************
  380.  
  381. :2upin1
  382. rem > c:\ra\mail!.txt
  383. goto start
  384.  
  385. rem ******************************************************
  386. rem * check for node 1 and node 3 online                 *
  387. rem * if so, create waiting mail file.                   *
  388. rem ******************************************************
  389.  
  390. :1upin
  391. if exist c:\ra\N1isup.txt goto 1upin1
  392. if exist c:\ra\N3isup.txt goto 1upin1
  393.  
  394. rem ******************************************************
  395. rem * otherwise toss the mail!                           *
  396. rem ******************************************************
  397.  
  398. goto tossit
  399.  
  400. rem ******************************************************
  401. rem * create mail file and loop back to start            *
  402. rem ******************************************************
  403.  
  404. :1upin1
  405. rem > c:\ra\mail!.txt
  406. goto start
  407.  
  408. rem ******************************************************
  409. rem * lock out other nodes from coming online during     *
  410. rem * inbound mail processing.                           *
  411. rem ******************************************************
  412.  
  413. :tossit
  414. echo.
  415. echo Locking out other nodes for the Tossing of INBOUND mail...
  416. rem>c:\ra\%node%toss.txt
  417. echo.
  418. echo Making sure phone is OFF the hook...
  419. dtr com%port%: off
  420. dtr com%port%: on
  421. at com%port%: h1
  422. echo.
  423. echo Looking to see what we got. Don'cha love christmas -=B-)
  424.  
  425. rem ******************************************************
  426. rem * checking for new FIDO Snooze. if it's there,       *
  427. rem * unarchive it into the FNEWS directory.             *
  428. rem ******************************************************
  429.  
  430. c:
  431. cd\fd\files\news
  432. if not exist ..\fnews???.* goto nodelist
  433. echo.
  434. echo Found new FIDO Snooze. Unpacking it...
  435. spaz -d ..\fnews*
  436.  
  437. rem ******************************************************
  438. rem * check for new nodediff file. if it's found, then   *
  439. rem * we process it.                                     *
  440. rem *                                                    *
  441. rem * this process looks complicated. actually it's not. *
  442. rem * in this process, we have to take down any FD nodes *
  443. rem * that might be up and running. we have to wait till *
  444. rem * they are down before we can continue.              *
  445. rem ******************************************************
  446.  
  447. :nodelist
  448. cd\fd\nodelist
  449. if exist c:\fd\files\nodediff.* goto fidodiff
  450. goto unpackmail
  451.  
  452. :fidodiff
  453. echo.
  454. echo Found a new FIDOnet NodeDiff....
  455.  
  456. :nodechker
  457. if %node% == N1 goto diffn1
  458. if %node% == N2 goto diffn2
  459. if %node% == N3 goto diffn3
  460.  
  461. :diffn1
  462. rem>c:\fd\n2\fdexit.255
  463. :1diffn1
  464. if not exist c:\ra\n2down.txt goto n1wait
  465. goto dofidodiffs
  466. :n1wait
  467. echo.
  468. echo Waiting for Node N2 to go down...
  469. dvcomand wait 50
  470. goto 1diffn1
  471. :diffn2
  472. rem>c:\fd\n1\fdexit.255
  473. :2diffn2
  474. if not exist c:\ra\n1down.txt goto n2wait
  475. goto dofidodiffs
  476. :n2wait
  477. echo.
  478. echo Waiting for Node N1 to go down...
  479. dvcomand wait 50
  480. goto 2diffn2
  481. :diffn3
  482. rem>c:\fd\n1\fdexit.255
  483. rem>c:\fd\n2\fdexit.255
  484. :3diffn3
  485. if not exist c:\ra\n1down.txt goto n3wait
  486. if not exist c:\ra\n2down.txt goto n3wait
  487. goto dofidodiffs
  488. :n3wait
  489. echo.
  490. echo Waiting on Node(s) to go down for Diff processing...
  491. dvcomand wait 50
  492. goto 3diffn3
  493.  
  494. rem ******************************************************
  495. rem * ok, the nodes are down. first thing is to save the *
  496. rem * the new nodediff. then we del the nodelist from 2  *
  497. rem * weeks ago from the save dir. copy last weeks       *
  498. rem * nodelist into the save dir. i use SYSNL to merge   *
  499. rem * the new nodediff with the new nodelist. it can     *
  500. rem * perform this process in about 1 minute on a 386 16 *
  501. rem * under DV with 1 or two tasks running. it will then *
  502. rem * delete the old nodelist and the new nodediff's     *
  503. rem * archive file when done. the .BAT file makes sure,  *
  504. rem * though<<grin>>. then we delete the nodediff from 5 *
  505. rem * weeks ago that we saved and .ZIP up the newly      *
  506. rem * compiled nodelist into the diffs dir. this diff dir*
  507. rem * is where i keep the nodelist and 5 weeks worth of  *
  508. rem * nodediffs for other systems to download them from  *
  509. rem * in case they mess up theirs or haven't updated     *
  510. rem * their nodelist in a while. it's a service i like   *
  511. rem * to provide. i know it has helped me out.           *
  512. rem * last weeks nodelist is saved in the save dir so in *
  513. rem * case there are any problems. you can then have a   *
  514. rem * better starting point rather than having to d/l it *
  515. rem * all again -=B-)                                    *
  516. rem ******************************************************
  517.  
  518. :dofidodiffs
  519. copy c:\fd\files\nodediff.* c:\files\diffs
  520. daynbr /-14 /d5 del c:\fd\nodelist\save\nodelist.@###
  521. daynbr /-7 /d5 copy c:\fd\nodelist\nodelist.@### c:\fd\nodelist\save
  522. sysnl merge nodelist nodediff c
  523. daynbr /-7 /d5 del c:\fd\nodelist\nodelist.@###
  524. daynbr /-7 /d5 del c:\files\diffs\nodelist.@Z##
  525. daynbr /-35 /d5 del c:\files\diffs\nodediff.@A##
  526. daynbr /d5 pkzip c:\files\diffs\nodelist.@Z## nodelist.@###
  527. goto compile
  528.  
  529. rem ******************************************************
  530. rem * now we compile the nodelist for FD and RA. then we *
  531. rem * go back up just in case we missed something. if    *
  532. rem * there are no more nodediffs to process,            * 
  533. rem * (ie: othernets) then we go from there on to do any *
  534. rem * inbound mail packets.                              *
  535. rem ******************************************************
  536.  
  537. :compile
  538. c:
  539. cd\fd\n1
  540. fdnc /f
  541. cd\ra\%node%
  542. ranode
  543. goto nodelist
  544.  
  545. rem ******************************************************
  546. rem * now we check the inbound mail. first step, though, *
  547. rem * is to bring back up any FD nodes that may be down. *
  548. rem ******************************************************
  549.  
  550. :unpackmail
  551. echo.
  552. echo Checking to see if FD Node(s) are down...
  553. if exist c:\ra\n?down.txt goto openfdnodes
  554. goto nodesup
  555.  
  556. :openfdnodes
  557. echo .
  558. echo Bringing FD Node(s) back online...
  559. if exist c:\fd\n1\fdexit.255 del c:\fd\n1\fdexit.255
  560. if exist c:\fd\n2\fdexit.255 del c:\fd\n2\fdexit.255
  561. if exist c:\ra\n1down.txt dvcomand open c:\dv\n1
  562. if exist c:\ra\n2down.txt dvcomand open c:\dv\n2
  563.  
  564. rem ******************************************************
  565. rem * do the tossing and kill the mail waiting flag file *
  566. rem * also, notify the FD nodes to rescan their message  *
  567. rem * image in memory.                                   *
  568. rem ******************************************************
  569.  
  570. :nodesup
  571. echo.
  572. echo Tossing INBOUND mail...
  573. echo.>>c:\logs\inbound.log
  574. echo Node %node% tossed this mail bundle.>>c:\logs\inbound.log
  575. c:
  576. cd\ra\%node%
  577. imail toss
  578. mbutil import
  579. mbutil link -clean
  580. rem>c:\fd\n1\fdrescan.now
  581. rem>c:\fd\n1\fmrescan.now
  582. rem>c:\fd\n2\fdrescan.now
  583. rem>c:\fd\n2\fmrescan.now
  584. if exist c:\ra\mail!.txt    del c:\ra\mail!.txt
  585. if exist c:\ra\N?toss.txt   del c:\ra\N?toss.txt
  586. if exist c:\ra\%node%inchck.txt goto back2update
  587. if exist c:\ra\%node%outchk.txt goto backfromtoss
  588. if %node% == N3 goto N3exit
  589. goto start
  590.  
  591. rem ******************************************************
  592. rem * one of the nodes is coming online in local mode.   *
  593. rem * make the nodeisup file to let the other one know   *
  594. rem * what is going on and load RA with the node number  *
  595. rem * in local mode.                                     *
  596. rem ******************************************************
  597.  
  598. :ralocal
  599. if %node% == N1 goto tosschk1l
  600. if %node% == N2 goto tosschk2l
  601. if %node% == N3 goto tosschk3l
  602. :tosschk1l                   
  603. if exist c:\ra\N2toss.txt goto fdbusyl
  604. if exist c:\ra\N3toss.txt goto fdbusyl
  605. :tosschk2l
  606. if exist c:\ra\N1toss.txt goto fdbusyl
  607. if exist c:\ra\N3toss.txt goto fdbusyl
  608. :tosschk3l
  609. if exist c:\ra\N1toss.txt goto fdbusyl
  610. if exist c:\ra\N2toss.txt goto fdbusyl
  611. echo.
  612. echo Notifying other nodes that this node is online...
  613. rem>c:\ra\%node%isup.txt
  614. set oldport=%port%
  615. set port=0
  616. c:
  617. cd\ra\%node%
  618. ra -%node% -l -e20
  619. set port=%oldport%
  620. set oldport=
  621.  
  622. rem ******************************************************
  623. rem * check errorlevels on local mode exit and execute.  *
  624. rem ******************************************************
  625.  
  626. goto afterra
  627.  
  628. rem ******************************************************
  629. rem * local fdbusy display                               *
  630. rem ******************************************************
  631.  
  632. :fdbusyl
  633. type c:\ra\fdbusy.txt
  634. dvcomand wait 50
  635. goto start
  636.  
  637. rem ******************************************************
  638. rem * normal fdbusy display                              *
  639. rem ******************************************************
  640.  
  641. :fdbusy
  642. echo.
  643. echo Notifying user of System Maintainence in progress.
  644. echo.
  645. type c:\ra\fdbusy.txt > com%port%:
  646. dtr com%port%: off
  647. dtr com%port%: on
  648. at com%port%: h1
  649. goto start
  650.  
  651. rem ******************************************************
  652. rem * ok, now we can do the outbound stuff               *
  653. rem * first check to see which node we are. then see if  *
  654. rem * we have any inbound waiting to be tossed.          *
  655. rem ******************************************************
  656.  
  657. :outbound
  658. if %node% == N1 goto downnode
  659. if %node% == N2 goto downnode
  660. if %node% == N3 goto nodeupout
  661.  
  662. rem ******************************************************
  663. rem * take node  offhook                                 *
  664. rem ******************************************************
  665.  
  666. :downnode
  667. dtr com%port%: off
  668. dtr com%port%: on
  669. at com%port%: h1
  670. if %node% == N2 goto nodeupout
  671. if %node% == N1 goto nodeupout
  672.  
  673. rem ******************************************************
  674. rem * check to see if we have inbound waiting.           *
  675. rem * if so, let's try to toss it before we scan         *
  676. rem * outbound, otherwise, let's do the real thing.      *
  677. rem ******************************************************
  678.  
  679. :nodeupout
  680. echo.
  681. echo Checking for waiting INBOUND mail...
  682. if not exist c:\ra\mail!.txt goto jump
  683. echo.
  684. echo We have waiting INBOUND mail. Going to toss it now...
  685. rem>c:\ra\%node%outchk.txt
  686. goto inbound
  687. :jump
  688.  
  689. rem ******************************************************
  690. rem * we return here if we had to toss inbound before we *
  691. rem * scan for outbound.                                 *
  692. rem ******************************************************
  693.  
  694. :backfromtoss
  695. echo.
  696. echo Checking for another node online...
  697. if exist c:\ra\%node%outchk.txt del c:\ra\%node%outchk.txt
  698. if %node% == N1 goto 1echoloop
  699. if %node% == N2 goto 2echoloop
  700. if %node% == N3 goto 3echoloop
  701. :1echoloop
  702. if not exist c:\ra\N2isup.txt goto chk3
  703. echo.
  704. echo Node N2 is online. Waiting till later to scan OUTBOUND mail...
  705. goto start
  706. :2echoloop
  707. if not exist c:\ra\N1isup.txt goto chk3
  708. echo.
  709. echo Node N1 is online. Waiting till later to scan OUTBOUND mail...
  710. goto start
  711. :3echoloop
  712. if not exist c:\ra\N1isup.txt goto chk2
  713. echo.
  714. echo Node N1 is online. Waiting till later to scan OUTBOUND mail...
  715. if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
  716. goto end
  717. :chk2
  718. if not exist c:\ra\N2isup.txt goto echook
  719. echo.
  720. echo Node N2 is online. Waiting till later to scan OUTBOUND mail...
  721. if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
  722. goto end
  723. :chk3
  724. if not exist c:\ra\N3isup.txt goto echook
  725. echo.
  726. echo Node N3 is online. Waiting till later to scan OUTBOUND mail...
  727. goto start
  728.  
  729. rem ******************************************************
  730. rem * ok, now we are ready to scan for outbound mail.    *
  731. rem * when done, notify both FD nodes to rescan their    *
  732. rem * message base image in memory.                      *
  733. rem ******************************************************
  734.  
  735. :echook
  736. echo.
  737. echo Scanning for OUTBOUND mail...
  738. c:
  739. cd\ra\%node%
  740. if exist c:\ra\msgbase\echomail.bbs del c:\ra\msgbase\echomail.bbs
  741. if exist c:\ra\msgbase\netmail.bbs del c:\ra\msgbase\netmail.bbs
  742. mbutil export
  743. imail scan
  744. rem>c:\fd\n1\fdrescan.now
  745. rem>c:\fd\n1\fmrescan.now
  746. rem>c:\fd\n2\fdrescan.now
  747. rem>c:\fd\n2\fmrescan.now
  748.  
  749. rem ******************************************************
  750. rem * ok. now we try to update the bulletins and such.   *
  751. rem * we first check to see if another node is up. if    *
  752. rem * it is, then we let it handle everything when it    *
  753. rem * exits.                                             *
  754. rem ******************************************************
  755.  
  756. :update
  757. echo.
  758. echo Attempting to update user bulletins...
  759. if %node% == N3 goto lookup
  760. dtr com%port%: off
  761. dtr com%port%: on
  762. at com%port%: h1
  763.  
  764. rem ******************************************************
  765. rem * first see if there is waiting inbound mail. if so, *
  766. rem * let's handle it.                                   *
  767. rem ******************************************************
  768.  
  769. :lookup
  770. if not exist c:\ra\mail!.txt goto jump1
  771. rem>%node%inchck.txt
  772. goto inbound
  773. :jump1
  774.  
  775. rem ******************************************************
  776. rem * now, check to see if there is waiting outbound     *
  777. rem * mail. if so, let's handle it.                      *
  778. rem ******************************************************
  779.  
  780. :back2update
  781. if exist c:\ra\msgs\echomail.bbs goto outbound
  782. if exist c:\ra\msgs\netmail.bbs goto outbound
  783.  
  784. rem ******************************************************
  785. rem * finally got all the mail taken care of. now it's   *
  786. rem * time for the user bulletins...                     *
  787. rem ******************************************************
  788.  
  789. if %node% == N1 goto check1
  790. if %node% == N2 goto check2
  791. if not exist c:\ra\N1isup.txt goto chck2
  792. echo.
  793. echo Node N1 is online. Waiting till later to update bulletins...
  794. if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
  795. goto end
  796. :check2
  797. if not exist c:\ra\N1isup.txt goto chck3
  798. echo.
  799. echo Node N1 is online. Waiting till later to update bulletins...
  800. if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
  801. goto start
  802. :check1
  803. if not exist c:\ra\N2isup.txt goto chck3
  804. echo.
  805. echo Node N2 is online. Waiting till later to update bulletins...
  806. if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
  807. goto start
  808. :chck2
  809. if not exist c:\ra\N2isup.txt goto doupdate
  810. echo.
  811. echo Node N2 is online. Waiting till later to update bulletins...
  812. if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
  813. goto end
  814. :chck3
  815. if not exist c:\ra\N3isup.txt goto doupdate
  816. echo.
  817. echo Node N3 is online. Waiting till later to update bulletins...
  818. if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
  819. goto start
  820.  
  821. rem ******************************************************
  822. rem * WHEW! We can finally update the bulletins...       *
  823. rem ******************************************************
  824.  
  825. :doupdate
  826. usa
  827.  
  828. rem ******************************************************
  829. rem * if this task is Node 3, we can now exit and shut   *
  830. rem * down this task.                                    *
  831. rem ******************************************************
  832.  
  833. :n3exit
  834. del c:\ra\%node%isup.txt
  835. if %node% == N3 goto end
  836. goto start
  837.  
  838. rem ******************************************************
  839. rem * all nightly maintenence is done by node 1.         *
  840. rem * make sure the other node is not doing anything     *
  841. rem * first. if it is, then wait a minute and try again. *
  842. rem ******************************************************
  843.  
  844. :nightly
  845. dtr com%port%: off
  846. dtr com%port%: on
  847. at com%port%: h1
  848. if exist c:\ra\N1isup.txt del c:\ra\N1isup.txt
  849. if exist c:\ra\N2isup.txt goto wait
  850. if exist c:\ra\N2toss.txt goto wait
  851. if exist c:\ra\N3isup.txt goto wait
  852. if exist c:\ra\N3toss.txt goto wait
  853. echo.
  854. echo Running Nightly Maintenance...
  855. rem>c:\ra\N1toss.txt
  856. call c:\ra\runmaint.bat
  857. goto start
  858.  
  859. rem ******************************************************
  860. rem * we come here to wait for the other node to go down *
  861. rem ******************************************************
  862.  
  863. :wait
  864. echo.
  865. echo Waiting on another node so I can run nightly maintenance...
  866. dvcomand wait 100
  867. goto nightly
  868.  
  869. rem ******************************************************
  870. rem * weekly maintenence is done by node 1.              *
  871. rem ******************************************************
  872.  
  873. :weekly
  874. if %node% == N1 dtr com%port%: on
  875. if %node% == N1 at com%port%: h1
  876. if %node% == N2 goto start
  877. if exist c:\ra\N1isup.txt del c:\ra\N1isup.txt
  878. if exist c:\ra\N2isup.txt goto wwait
  879. if exist c:\ra\N2toss.txt goto wwait
  880. if exist c:\ra\N3isup.txt goto wwait
  881. if exist c:\ra\N3toss.txt goto wwait
  882. echo.
  883. echo Running Weekly Maintenance...
  884. rem>c:\ra\N1toss.txt
  885. imthings stat
  886. goto start
  887.  
  888. rem ******************************************************
  889. rem * we come here to wait for the other node to go down *
  890. rem ******************************************************
  891.  
  892. :wwait
  893. echo.
  894. echo Waiting on another node so I can run weekly maintenance...
  895. dvcomand wait 100
  896. goto weekly
  897.  
  898. rem ******************************************************
  899. rem * OOPS! we have some kind of error!                  *
  900. rem ******************************************************
  901.  
  902. :enderror
  903. cls
  904. echo Node %node% is down with a FATAL error!
  905. echo Attempting to reload and correct in 5 seconds..
  906. dvcomand wait 50
  907. bnu /c
  908. goto start
  909.  
  910. rem ******************************************************
  911. rem * normal exit from any node                          *
  912. rem ******************************************************
  913.  
  914. :endok
  915. cls
  916. dtr com%port%: off
  917. dtr com%port%: on
  918. at com%port%: h1
  919. :endok2
  920. echo Node %node% has been exited normally. The phone is unuseable.
  921.  
  922. rem ******************************************************
  923. rem * make sure we kill any existing lockout files       *
  924. rem * if we are running this without DV, unload the      *
  925. rem * FOSSIL driver.                                     *
  926. rem ******************************************************
  927.  
  928. :end
  929. if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
  930. if exist c:\ra\%node%load.txt del c:\ra\%node%load.txt
  931. rem>c:\ra\%node%down.txt
  932. :endok3
  933. dvactive
  934. if errorlevel 1 exit
  935. bnu /u
  936.